from django.db import models
from django.contrib.auth.models import User

class Hotel(models.Model):
  name = models.CharField(max_length=200)
  image = models.ImageField(max_length=400,upload_to='static/imgs/hotels/')
  country = models.CharField(max_length=200)
  city = models.CharField(max_length=200)

  def __unicode__(self):
    return self.name

ROOM_TYPES = (('Single','Single'),('Double','Double'),('Triple','Triple'))

class Room(models.Model):
  hotel = models.ForeignKey(Hotel)
  name = models.CharField(max_length=200)
  image = models.ImageField(max_length=400,upload_to='static/imgs/rooms/')
  type = models.CharField(max_length=6,choices=ROOM_TYPES)
  number = models.IntegerField()

  def __unicode__(self):
    return self.type

class Room_serve(models.Model):
  room = models.ForeignKey(Room)
  checkIn_date = models.DateField('CheckIn Time :')
  checkOut_date = models.DateField('CheckOut Time :')

class Review(models.Model):
    hotel = models.ForeignKey(Hotel)
    user = models.ForeignKey(User)
    comment = models.TextField()
    rate = models.CharField(max_length=1)